package com.gzx.plugin.tjzy.modular.debtor.controller;

import com.gzx.plugin.tjzy.modular.debtor.entity.bo.GzxDebtorInfoEditBo;
import com.gzx.plugin.tjzy.modular.debtor.entity.vo.GzxDebtorInfoVo;
import com.gzx.plugin.tjzy.modular.debtor.service.GzxDebtorInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.common.annotation.CommonLog;
import vip.xiaonuo.common.pojo.CommonResult;

import java.util.List;

/**
 * @author zjt
 * @description
 * @date 2024/12/4 09:22
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/tjzy/debtor")
public class GzxDebtorInfoController {

    private final GzxDebtorInfoService debtorInfoService;


    /**
     * 获取案件详情页头部信息
     */
    @GetMapping("getDebtorByCaseId/{caseId}")
    public CommonResult<List<GzxDebtorInfoVo>> getDebtorByCaseId(@PathVariable Long caseId) {
        return CommonResult.data(debtorInfoService.getDebtorByCaseId(caseId));
    }

    /**
     * 获取案件详情页头部信息
     */
    @CommonLog("补充欠款人真实身份证号")
    @PostMapping("/edit")
    public CommonResult<Void> updateDebtorInfo(@RequestBody GzxDebtorInfoEditBo debtorInfoBo) {
        debtorInfoService.updateDebtorInfo(debtorInfoBo);
        return CommonResult.ok();
    }


    /**
     * 根据欠款人查询明文手机号
     */
    @CommonLog("查询欠款人关系的明文信息")
    @GetMapping("/getPlaintextById/{id}")
    public CommonResult<String> getPlaintextById(String type, @PathVariable Long id) {
        return CommonResult.data(debtorInfoService.getPlaintextById(type, id));
    }
}
